<template>
 <!-- 晨会智家 - 月看板 -->
  <div>
    <van-loading v-if="isLoading" type="spinner" color="#1989fa" />
    <div v-else class="board-zj-info">
      <div class="board-zj-item" v-for="(item, index) in infoList" :key="item.KPI_CODE" :class="`bg${index+1}`" @click="openPeopleDetail(item.KPI_CODE, item.KPI_VALUE, item.TOTAL_VALUE, item.HB)">
        <div>{{ item.KPI_NAME }}</div>
        <div class="sub-title">当月累计/本年累计</div>
        <div class="value">{{ item.KPI_VALUE || 0 }}/{{ item.TOTAL_VALUE || 0 }}<span class="unit">户</span></div>
        <div class="percent-title">
          环比
          <span v-if="item.HB >= 0" class="percent up">
            {{ item.HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_up.png" />
          </span>
          <span v-else class="percent down">
            {{ item.HB }}%
            <img src="~@/assets/imgs/publicline/index/arrow_down.png" />
          </span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { morningMonthWise } from '@/api/publicline/board.js'

export default {
  components: {  },
  data() {
    return {
      isLoading: true,
      infoList: [],
      queryParams: {}
    }
  },
  methods: {
    // 晨会看板-月看板-智家
    async getMorningMonthWise(params) {
      this.isLoading = true
      this.queryParams = params
      const res = await morningMonthWise(params)
      const { result, success } = res
      if (success) {
        this.infoList = result
        this.isLoading = false
      }
    },
    openPeopleDetail(type, value = 0, mvalue = 0, hb = 0) {
      this.$open.call(this, '/publicline/board/monthPersonal',
        {
          monthId: this.queryParams.monthId,
          type: type,
          value, mvalue, hb
        }
      )
    }
  }
}
</script>
